package config;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class WebInitCondition implements Condition{
	
	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		//开发环境
		boolean isDevelopProfile = metadata.isAnnotated("com.annotation.DevelopProfile");  
        //生产环境
		boolean isQaProfile = metadata.isAnnotated("com.annotation.QaProfile");  
        if(!isDevelopProfile && !isQaProfile) {  
            return true;  
        }
        
        //启用开发环境
        if(isDevelopProfile) {  
            return true;  
        }else{
        	return false;
        }  
//        启用生产环境
//        if(isQaProfile) {  
//            return true;  
//        }else{
//        	return false;
//        } 
    }  
}
